package Main;


public class Pieces {

	public Pieces() {
		for(int i=0;i<dimX;i++) {
			for(int j=0;j<dimY;j++) {
				pieces[i][j]=BLANK;
			}
		}
	}
	
	public int[][] getPieces() {
		return pieces;
	}
	
	public int getOnePiece(int x,int y) {
		
		if(x>=dimX || y>=dimY) {
			return 0;
		}
//		System.out.println(" x "+x+" y "+y+" : "+pieces[x][y]);
		return pieces[x][y];
	}
	
	public void setOnePiece(int x, int y) {
		if(x>=dimX || y>=dimY) {
			return;
		}
		lastX = x;
		lastY = y;
		if(isBlack) {
			pieces[x][y]=BLACK;
			lastColor = BLACK;
		}else {
			pieces[x][y]=WHITE;
			lastColor = WHITE;
		}
		isBlack = !isBlack;
	}
	
	public int lastX;
	public int lastY;
	public int lastColor;
	
	public static final int dimX = 15;
	public static final int dimY = 15;
	
	public static final int WHITE = 1;
	public static final int BLACK = 0;
	public static final int BLANK = 0xff;
	
	private int[][] pieces = new int[dimX][dimY];
	private boolean isBlack = true;
}
